package cn.enzo.yun.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.enzo.utils.service.CommonServiceImpl;
import cn.enzo.yun.dao.StoreDao;
import cn.enzo.yun.domain.Store;
import cn.enzo.yun.service.IStoreService;


@Service
public class StoreServiceImpl extends CommonServiceImpl<Store> implements IStoreService {

	@Autowired
	private StoreDao storeDao;
	
	
	@Override
	public Integer save(Store entity) throws Exception{
		entity.setIsdelete(false);
		entity.setCreatetime(new Date());
		return storeDao.save(entity);
	}
	
	@Override
	public Store selectByKey(Object key) throws Exception{
		return storeDao.selectByKey(key);
	}
	
	@Override
	public Integer deleteBykey(Object key) throws Exception{
		Store store = storeDao.selectByKey(key);
		store.setIsdelete(true);
		return storeDao.update(store);
	}
	
	
	@Override
	public List<Store> queryByCondition(Store entity) throws Exception {
		return storeDao.queryByCondition(entity);
	}
}
